<div class="row-fluid sortable ui-sortable">
	<div id="list-jalur" class="box span12">
		<div class="box-header well" data-original-title>
			<h2><i class="icon-home"></i>Jalur Distribusi</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
			</div>
		</div>
		<div class="box-content">
			<div id="diagram-jalur" style="float:left;margin-left:15px;padding:20px 10px 10px 10px;" class="box span3">
			<?php
				
				if($jalur){
					$i=0;
					$margin_top="";
					foreach($jalur->result_array() as $row){
						if($i>0){
							echo "<span center style='margin-left:42%;' class='icon32 icon-color icon-arrowthick-s'></span></br>";
							$margin_top="17px;";
						}
						echo "
							<div style='margin-top:".$margin_top."; margin-bottom:14px;width:84%;' class='titik btn btn-large btn-primary'>".$row["NAMA"]."</div></br>
						";
						$i++;
					}
				}
			?> 
			</div>
			<div id="data-jalur" class="box span8" style="float:right;margin-right: 30px;padding: 10px;">
				<table class="table table-striped table-bordered bootstrap-datatable datatable">
					<thead>
						<tr>
							<th>Nama</th>
							<th>Keterangan</th>
							<th>Action</th>
						</tr>
					</thead>   
					<tbody>
					<?php
						if($jalur){
							foreach($jalur->result_array() as $row){
								echo"<tr>
									<td class='nama".$row['ID']."'>".$row['NAMA']."</td>
									<td class='alamat".$row['ID']."'>".$row['CATATAN']."</td>
									<td class='center'>
											<a class='btn btn-danger hapus-list' title='Delete' onclick='deleteList(".$row['ID'].");'>
												<i class='icon-trash icon-white'></i> 
												delete
											</a>
									</td>
								</tr>";
							}
						}
					?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<script>
	function deleteList(id){
		$.ajax({
			url: "<?= base_url(); ?>jalur_distribusi/delete_jalur",
			type: "POST",
			data: "id="+id,
			success: function(msg){
				window.location = "<?= base_url(); ?>jalur_distribusi";
			}
		});
	}
</script>

